<?php 
/*
$sharedBlockId=getObjByKey("portal_sharedblock_container","sharedBlockId","id",$coupleId);


$container="container".getObjByKey("portal_sharedblock_container","containerName","id",$coupleId);

$sSql ="SELECT
portal_portlet.appname,
portal_portlet.appurl,
portal_portlet.title,
'1' as id,
portal_sharedblock_portlets.orderCmpnt
FROM
portal_portlet
INNER JOIN portal_sharedblock_portlets ON portal_sharedblock_portlets.portletId = portal_portlet.id
WHERE
portal_sharedblock_portlets.sharedblockId = $sharedBlockId
ORDER BY
portal_sharedblock_portlets.orderCmpnt ASC ";
//echo $sSql ;
$rs=$GLOBALS["conn"]->Execute($sSql);

while ($rs && !$rs->EOF)  {

	$appname=$rs->fields["appname"];
	$appurl=$rs->fields["appurl"];
	$apptitle=$rs->fields["title"];
	$id=$rs->fields["id"];
	?>
		<script type="text/javascript">
		//alert("ok");
			setup_portlet("<?=$appname?>","<?=$appurl?>","<?=$container?>",<?=$id?>,false,"<?=$apptitle?>");
		</script>
		<?php 
	$rs->MoveNext();
}*/

//echo $mode;
$pageId=$portlet_sharedblocks_pageId;//getObjByKey("portal_sharedblock_container","pageId","id",$coupleId);

if ($pageId!=null || $pageId!="")
{
if ($mode=="edit"){ 

$pageName=getObjByKey("portal_pages","name","id",$pageId);




?>


<iframe scrolling="no"  src="/?pageName=<?=$pageName?>&mode=edit&nocontrols=true" frameBorder="0" width="100%" height="100%" id="iframe_<?=$pageName?>" marginheight="0" onLoad="autoResize('iframe_<?=$pageName?>');" >

</iframe>

<?php }else{
	

	$layout=getPageLayout($pageId);
	

	//Shared Blocks
	
	$sSql="Select portal_portlet.id as portletId,
	portal_portletpage.orderCmpnt as portletOrder,
	portal_portlet.appname, portal_portlet.appurl,
	portal_portletpage.place,
	portal_portletpage.id as instanceId
	From portal_portletpage Inner Join
	portal_portlet On portal_portlet.id = portal_portletpage.portletId
	Inner Join portal_pages On portal_pages.id = portal_portletpage.pageId
	Where portal_pages.portalId=$portalId And portal_pages.id = $pageId ";
	
	//$layout=" echo 'ok';";
	include 'addportletinlayout.php';
	//echo $layout;
	eval($layout);

}
}

?>
